﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IRongs.Wbt.Common.Entities;

namespace IRongs.Wbt.Common.Auth
{
    /// <summary>
    /// IRequestable can be used to send request with the authenticated user info.
    /// </summary>
    public interface IRequestable
    {

        /// <summary>
        /// Sends the request to specified URL, the user authentication info will be included automatically.
        /// </summary>
        /// <typeparam name="T">The returned JSON data will be translated to this type of entity.</typeparam>
        /// <param name="url">The URL.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The object information returned from the requests.</returns>
        T SendRequest<T>(string url, Method method, IEnumerable<QueryParameter> parameters) where T : IEntity;

        /// <summary>
        /// Sends the request to specified URL, the user authentication info will be included automatically.
        /// </summary>
        /// <typeparam name="T">The returned JSON data will be translated to this type of entity.</typeparam>
        /// <param name="url">The URL.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The object information returned from the requests.</returns>
        string SendRequest(string url, Method method, IEnumerable<QueryParameter> parameters);

    }
}
